#include <stdio.h>
#include <assert.h>

#include "canvas.h"
#include "pen_impl.h"

namespace visgrph
{

syncobject g_pen_syncobj;

pen::pen()
: m_pen(NULL)
{
	m_pen = new pen_impl();
	assert(NULL != m_pen);
}

pen::~pen()
{
	autosync sync(g_pen_syncobj);
	if (m_pen)
	{
		delete m_pen;
		m_pen = NULL;
	}
}

pen::pen(const pen& p)
: m_pen(NULL)
{
	if (this != &p)
	{
		assert(NULL != p.m_pen);
		m_pen->assign(*p.m_pen);
	}
}

pen::pen(float width, color c, pen_style ps)
: m_pen(NULL)
{
	m_pen = new pen_impl(width, c, ps);
	assert(NULL != m_pen);
}

pen_cap_type pen::cap_type(pen_cap_type type)
{
	return m_pen->cap_type(type);
}

pen_join_type pen::join_type(pen_join_type type)
{
	return m_pen->join_type(type);
}

}; // namespace visgrph
/* EOF */
